//package com.plian.system.controller.dj;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.plian.Tools.Func;
//import com.plian.Tools.StringPool;
//import com.plian.Tools.base.BaseController;
//import com.plian.system.config.Resubmit;
//import com.plian.system.entity.dj.DjPartymemberBaseInfo;
//import com.plian.system.model.CommonCode;
//import com.plian.system.model.ListResult;
//import com.plian.system.model.R;
//import com.plian.system.mybatis.search.SearchEntity;
//import com.plian.system.mybatis.search.SearchParamEntiy;
//import com.plian.system.mybatis.search.TokenSearch;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.mybatis.support.Query;
//import com.plian.system.service.dj.IDjPartymemberBaseinfoService;
//import com.plian.system.vo.dj.DjPartymemberBaseInfoVO;
//import com.plian.system.wrapper.dj.DjPartymemberBaseInfoWrapper;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiResponse;
//import io.swagger.annotations.ApiResponses;
//import lombok.AllArgsConstructor;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.validation.Valid;
//import java.util.List;
//
///**
// * 国资党建-党员基本信息模块
// **/
//@RestController
//@AllArgsConstructor
//@RequestMapping("api/base_partymember")
//@Api(value = "国资党建-党员基本信息模块", tags = "国资党建-党员基本信息模块")
//public class DjPartymemberBaseinfoController extends BaseController {
//
//    private final IDjPartymemberBaseinfoService partymemberBaseinfoService;
//
//    private final DjPartymemberBaseInfoWrapper djPartymemberBaseinfoWrapper;
//
//
//    /**
//     * 新增或修改
//     */
//    @ApiOperation(value = "新增或修改", notes = "新增或修改")
//    @ApiResponses({
//            @ApiResponse(code = 1000, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//
//    @PostMapping("/submit")
//    @Resubmit(delaySeconds = 0)
//    public R submit(@Valid @RequestBody DjPartymemberBaseInfo djPartymemberBaseinfo) {
//        return R.status(partymemberBaseinfoService.submit(djPartymemberBaseinfo));
//    }
//
//    /**
//     * 查询详情
//     */
//    @ApiOperation(value = "查询详情", notes = "查询详情")
//    @ApiResponses({
//            @ApiResponse(code = 1000, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @PostMapping("/detail")
//    public R<DjPartymemberBaseInfoVO> detail(@RequestBody DjPartymemberBaseInfo djPartymemberBaseinfo) {
//        DjPartymemberBaseInfo detail = partymemberBaseinfoService.getOne(Condition.getQueryWrapper(djPartymemberBaseinfo));
//        return R.data(djPartymemberBaseinfoWrapper.entityToVO(detail));
//    }
//
//    /**
//     * 列表分页
//     */
//    @ApiOperation(value = "列表分页", notes = "列表分页")
//    @ApiResponses({
//            @ApiResponse(code = 1000, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @PostMapping("/list")
//    public ListResult<DjPartymemberBaseInfoVO> list(@RequestBody Query query) {
//        List<SearchEntity> entityList = query.getSearch();
//        if (query.getAscs() == null && query.getDescs() == null) {
//            query.setDescs("create_time");
//        }
//        QueryWrapper<DjPartymemberBaseInfo> queryWrapper = SearchParamEntiy.getQueryWrapper(
//                Condition.getQueryWrapper(new DjPartymemberBaseInfo()), entityList
//        );
//        TokenSearch<DjPartymemberBaseInfo> tokenSearch = new TokenSearch<>();
//		tokenSearch.addTokenQuery(queryWrapper, query);
//        IPage<DjPartymemberBaseInfo> pages = partymemberBaseinfoService.page(Condition.getPage(query), queryWrapper);
//        ListResult<DjPartymemberBaseInfoVO> listResult = new ListResult<>(CommonCode.SUCCESS);
//        listResult.setList(djPartymemberBaseinfoWrapper.entityToVO(pages.getRecords()));
//        listResult.setTotal(Long.valueOf(pages.getTotal()).intValue());
//        return listResult;
//    }
//
//    /**
//     * 删除
//     */
//    @ApiOperation(value = "删除", notes = "删除")
//    @ApiResponses({
//            @ApiResponse(code = 1000, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @Transactional(rollbackFor = Throwable.class)
//    @PostMapping("/submit")
//    public R remove(@RequestBody DjPartymemberBaseInfoVO djPartymemberBaseinfoVO) {
//        List<Long> ids = djPartymemberBaseinfoVO.getIds();
//        return R.status(partymemberBaseinfoService.deleteLogic(Func.toLongList(StringUtils.join(ids, StringPool.COMMA))));
//    }
//
//    /**
//     * 年龄分布
//     **/
//    @ApiOperation(value = "年龄分布", notes = "年龄分布")
//    @ApiResponses({
//            @ApiResponse(code = 1000, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @PostMapping("/analysePartyMemberAge")
//    public R analysePartyMember(@RequestBody DjPartymemberBaseInfoVO djPartymemberBaseinfoVO) {
//        return partymemberBaseinfoService.analysePartyMember(djPartymemberBaseinfoVO, "age");
//    }
//
//    /**
//     * 学历分布
//     **/
//    @ApiOperation(value = "学历分布", notes = "学历分布")
//    @ApiResponses({
//            @ApiResponse(code = 1000, message = "操作成功"),
//            @ApiResponse(code = 500, message = "服务器错误"),
//    })
//    @PostMapping("/analysePartyMemberEdubk")
//    public R analysePartyMemberAge(@RequestBody DjPartymemberBaseInfoVO djPartymemberBaseinfoVO) {
//        return partymemberBaseinfoService.analysePartyMember(djPartymemberBaseinfoVO, "edu");
//    }
//
//}
